<?php //var_dump($_SESSION['rwcards']['config']); ?>
<div id="category-box">
	<?php echo $this->rwcards_one_category_listcards_category_chosen_category . ": " . $this->categories; ?>
</div>

<?php
if ( count($this->data[0]) > 0)
{
?>
<div id="card-heading">
	<?php echo $this->rwcards_one_category_listcards_click_on_card_to_preview; ?>
</div>

<div id="card-list">
<table border="0">
<tr>
<?php

$k="";
for ($i=0, $n=count( $this->data ); $i < $n; $i++){
$imgDim = deserialize($this->data[$i]['size']);
?>
<td>
	<a href="<?php echo $this->Environment->base . $this->data[$i]['picture'];?>"
		rel="lightbox[atomium]""
		title="<?php echo strip_tags($this->data[$i]['description']); ?>"><img
		src="<?php echo $this->Environment->base .  $this->getImage($this->data[$i]['picture'], $imgDim[0], $imgDim[1], 'box');?>"
		alt="<?php echo strip_tags($this->data[$i]['description']); ?>"
		class="img-thumb" /></a>
	<br />
	<span class="send-this-img">
                <?php
                $cardId = ($this->rewriteCardId != "") ? $this->rewriteCardId : $this->data[$i]['id'];
                ?>
		<a href="<?php echo $this->generateFrontendUrl('',  $this->alias . '/view/rwcardsfilloutcard/id/' . $cardId .'/category_id/' . $this->category_id . '/reWritetoSender/' . $this->reWritetoSender . '/sessionId/' . @$this->sessionId . '/' . $this->alias)?>"><?php echo $this->rwcards_one_category_listcards_rwcards_one_category_send_this_image; ?></a>
	</span>
</td>
<?php
	$k++;
	if($k % $this->cardsPerLine == 0) {
		echo "</tr><tr>";
	}
}
?>
</tr>
</table>
</div>

<div id="limit"><?php echo $this->pagination; ?></div>

<div class="rwcardsClr"></div>
<?php
}
else
{
	echo $this->noCategoriesPublished;
}
?>

<script type="text/javascript">//<![CDATA[

$('ctrl_category_id').addEvent('change', function()
{
	var chosenCategory = $('ctrl_category_id').get('value');

	var all_cats = {
	<?php $done = false;
	foreach ( $this->category_ids as $key=>$categoryId ) {
		if ( $done ) echo ",\n";
		$done = true;
//		echo "'$categoryId[value]': '" . str_replace('&amp;', '&',
//			JRoute::_( 'index.php?option=com_rwcard&view=rwcard&Itemid=' . JRequest::getCmd("Itemid")
//			. '&category_id=' . $categoryId . '&reWritetoSender=' . @$this->reWritetoSender . '&sessionId=' . @$this->sessionId ) ) . "'";

		echo "'$categoryId[value]': '" . $this->generateFrontendUrl('',  $this->alias . '/view/rwconecategory/category_id/' . $categoryId[value] . '/reWritetoSender/' . $this->reWritetoSender . '/sessionId/' . @$this->sessionId . '/' . $this->alias) . "'";
	}
	echo '};';
	?>
	document.location.href = all_cats[ chosenCategory ];

});
//]]></script>